package developerworks.jetty6;
import java.io.IOException;
import javax.jms.*;
import javax.naming.InitialContext;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class ProducerServlet extends HttpServlet {
    

    
	public void init(ServletConfig config) throws ServletException 
    {
        //ApplicationAddressBook.subscriber = new EventSubscriber();
    }

    /* ------------------------------------------------------------ */
    public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException
    {
        /*try
        {
            String msg = request.getParameter("msg");
            response.setContentType("text/html");
            ServletOutputStream out = response.getOutputStream();
            out.println("<html>");
            out.println("<h1>Topic Test</h1>");
            out.println("<body>");

            EventSubscriber ps = new EventSubscriber();
            
            ps.publish(msg);
	          
			out.println("<p>Message: "+msg+" sent.</p>");
            out.flush();
        }
        catch (Exception e)
        {
            throw new ServletException(e);
        }*/

        
		System.out.println("counting");
		CrudMessage.subscriber.sendMessage("testing");
		response.getWriter().flush();
    }
    
}